// Define multi-architecture modules and pub use them.
cfg_if::cfg_if! {
    if #[cfg(target_arch = "loongarch64")] {
        mod loongarch64;
        pub use loongarch64::*;
    } else if #[cfg(target_arch = "aarch64")] {
        mod aarch64;
    } else if #[cfg(target_arch = "riscv64")] {
        mod riscv64;
        pub use riscv64::*;
    } else if #[cfg(target_arch = "x86_64")] {
        mod x86_64;
    } else {
        compile_error!("unsupported architecture!");
    }
}

#[unsafe(no_mangle)]
pub fn arch_init()
{
    crate::timer::Timer::timer_init();
    crate::heap_mem::init_heap();
    crate::heap_mem::test_heap_alloc();
}



#[macro_export]
macro_rules! hal_entry {
    ($callback:ident) => {
        #[unsafe(no_mangle)]
        pub extern "C" fn hal_entry() {
            crate::hal::boot::arch_init();
            $callback();
        }
    };
}